<script language="javascript" type="text/javascript">

    /*
    Auther :: Dharmendra Patri
    Email  :: admin@icymic.com
    Site   :: http://dpatri.com
              http://icymic.com
     */

    /*
    @param1 - sourceid - This is the id of the multiple select box whose item has to be moved.
    @param2 - destinationid - This is the id of the multiple select box to where the iterms should be moved.
     */

    //this will move selected items from source list to destination list
    function move_list_items(sourceid, destinationid)
    {
        $("#"+sourceid+"  option:selected").appendTo("#"+destinationid);
    }

    //this will move all selected items from source list to destination list
    function move_list_items_all(sourceid, destinationid)
    {
        $("#"+sourceid+" option").appendTo("#"+destinationid);
    }

</script>
<table>
    <tbody>
        <tr>
            <td>
                <select id="assignedShifts" multiple="multiple" name="assignedShifts">
                    <?php foreach ($assignments as $assign): ?>
                        <option value="<?php echo $assign->getShift()->getId()?>"><?php echo $assign->getShift()->getName()?></option>
                    <?php endforeach; ?>
                </select>
            </td>
            <td>
                <div><input id="moveright" type="button" value=">" onclick="move_list_items('assignedShifts','unassignedShifts');" /></div>

                <div><input id="moverightall" type="button" value=">>" onclick="move_list_items_all('assignedShifts','unassignedShifts');" /></div>

                <div><input id="moveleft" type="button" value="<" onclick="move_list_items('unassignedShifts','assignedShifts');" /></div>

                <div><input id="moveleftall" type="button" value="<<" onclick="move_list_items_all('unassignedShifts','assignedShifts');" /></div>

            </td>
            <td>
                  <select id="unassignedShifts" multiple="multiple" name="unassignedShifts">
                    <?php foreach ($missingShifts as $ms): ?>
                        <option value="<?php echo $ms->getId()?>"><?php echo $ms->getName()?></option>
                    <?php endforeach; ?>
                </select>
            </td>
        </tr>
    </tbody>
</table>


